import request from '@/config/axios'


export const SupApi = {
  // 创建商品
  createSup: async (data: any) => {
    return await request.post({ url: `/shops/goods/create`, data })
  },
  // 更新商品信息
  updateSup: async (data: any) => {
    return await request.put({ url: `/shops/goods/update`, data })
  },
  // 获得商品分页
  getSupPage: async (params: any) => {
    return await request.get({ url: `/shops/goods/page`, params })
  },
  // 获得商品信息
  getSup: async (id: number) => {
    return await request.get({ url: `/shops/goods/get?id=` + id })
  },
  // 删除商品
  deleteSpu: async (id: number) => {
    return await request.delete({ url: `/shops/goods/delete?id=` + id })
  },
  // 删除商品详情也就是子里面的删除
  deleteGoodsInfo: async (id: number) => {
    return await request.delete({ url: `/shops/goods-info/delete?id=` + id })
  },
  // 获取商铺信息列表
  getShopInfoList: async () => {
    return await request.get({ url: `/shops/info/list` })
  },
  // 获取父商品评论分页
  getParentGoodsCommentPage: async (goodsId: number, pageSize: number, pageNo: number) => {
    return await request.get({ url: `/shops/goods-comment/page?goodsId=${goodsId}&pageSize=${pageSize}&pageNo=${pageNo}` })
  },
  // 获取子商品评论分页
  getSonGoodsCommentPage: async (infoId: number, pageSize: number, pageNo: number) => {
    return await request.get({ url: `/shops/goods-comment/page?infoId=${infoId}&pageSize=${pageSize}&pageNo=${pageNo}` })
  },
  // 删除评论
  deleteGoodsComment: async (id: number) => {
    return await request.delete({ url: `/shops/goods-comment/delete?id=` + id })
  }
}